load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "tidb",
    srcs = ["tidb.go"],
    importpath = "github.com/pingcap/tidb/pkg/lightning/backend/tidb",
    visibility = ["//visibility:public"],
    deps = [
        "//pkg/errno",
        "//pkg/lightning/backend",
        "//pkg/lightning/backend/encode",
        "//pkg/lightning/backend/kv",
        "//pkg/lightning/common",
        "//pkg/lightning/config",
        "//pkg/lightning/errormanager",
        "//pkg/lightning/log",
        "//pkg/lightning/verification",
        "//pkg/meta/model",
        "//pkg/parser/ast",
        "//pkg/parser/mysql",
        "//pkg/table",
        "//pkg/types",
        "//pkg/util",
        "//pkg/util/dbutil",
        "//pkg/util/hack",
        "//pkg/util/kvcache",
        "//pkg/util/logutil",
        "//pkg/util/redact",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_google_uuid//:uuid",
        "@com_github_pingcap_errors//:errors",
        "@com_github_pingcap_failpoint//:failpoint",
        "@org_uber_go_zap//:zap",
        "@org_uber_go_zap//zapcore",
    ],
)

go_test(
    name = "tidb_test",
    timeout = "short",
    srcs = ["tidb_test.go"],
    flaky = True,
    shard_count = 17,
    deps = [
        ":tidb",
        "//pkg/errno",
        "//pkg/lightning/backend",
        "//pkg/lightning/backend/encode",
        "//pkg/lightning/backend/kv",
        "//pkg/lightning/common",
        "//pkg/lightning/config",
        "//pkg/lightning/errormanager",
        "//pkg/lightning/log",
        "//pkg/lightning/verification",
        "//pkg/meta/model",
        "//pkg/parser/ast",
        "//pkg/parser/charset",
        "//pkg/parser/mysql",
        "//pkg/table",
        "//pkg/table/tables",
        "//pkg/types",
        "@com_github_data_dog_go_sqlmock//:go-sqlmock",
        "@com_github_go_sql_driver_mysql//:mysql",
        "@com_github_stretchr_testify//require",
        "@org_uber_go_atomic//:atomic",
        "@org_uber_go_zap//:zap",
    ],
)
